﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Manager/Manager.master" AutoEventWireup="true"
    CodeFile="ManagerQuestion.aspx.cs" Inherits="Manager_ManagerQuestion" %>

<asp:Content ID="Content1" ContentPlaceHolderID="PageTitle" runat="Server">
    Question Manager | Aptitude Online Test
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PageHeader" runat="Server">
    <link type="text/css" rel="stylesheet" href="../Style/dataTables.css" />
    <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            //check show message
            if ($("#ctl00_BodyContent_lblmes").text() != "") {
                setTimeout('showSuccess( $("#ctl00_BodyContent_lblmes").text())', 100);
            }
            //add candidate
            $("#addNew").click(function () {
                window.location.href = 'AddQuestion.aspx';
            });
        })

        function EditQuestion(QuestionID) {
            window.location.href = 'EditQuestion.aspx?ID=' + QuestionID;
        }

        function DeleteQuestion(QuestionID) {
            if (confirm("Delete Question : " + QuestionID + "?")) {
                $.post("../ajax.asmx/DeleteQuestion",
                    {
                        QuestionID: QuestionID
                    },
                    function (data) {
                        window.location.href = 'ManagerQuestion.aspx';
                    }).error(function () { alert("Error! Cannot delete Question"); });
            }
            else
                return false;
        }

        // highlight the row when clicked
        $(document).ready(function () {
            $("table tbody tr").mouseover(function () {
                $(this).addClass("highlightRow");
            }).mouseout(function () { $(this).removeClass('highlightRow'); })
        });

        // highlight row by clicking it
        $(document).ready(function () {
            $("table tbody tr").click(function () {
                $("#grvCandidate").find("tr.select").removeClass('select');
                $(this).addClass("select");
            })
        });
    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="BodyContent" runat="Server">
    <div class="header">
        <span><span class="ico  gray spreadsheet"></span>Manager Question </span>
    </div>
    <!-- End header -->
    <div class=" clear">
    </div>
    <div class="content">
        <p>
            <a id="addNew" title="Add">Add new question</a></p>
        <p>
         <p>
            <asp:Label ID="lblSearch" runat="server" Text="Search by question content : "></asp:Label>
            <asp:TextBox ID="txtkeySearch" runat="server" Width="250px" 
                CausesValidation="True"></asp:TextBox>
                <asp:Button ID="btnSearch" class="uibutton normal"  runat="server" 
                onclientclick="" Text="Search" onclick="btnSearch_Click" />
        </p>
            <asp:Label ID="lblmes" runat="server" Text=""></asp:Label>
            <asp:GridView ID="grvQuestion" runat="server" AutoGenerateColumns="False" CellPadding="4"
                DataKeyNames="ID" GridLines="None" AllowPaging="True" PageSize="10" OnPageIndexChanging="grvQuestion_PageIndexChanging"
                CssClass="tablegrid">
                <AlternatingRowStyle BackColor="White" HorizontalAlign="Left" />
                <Columns>
                    <asp:BoundField DataField="Content" HeaderText="Content" />
                    <asp:BoundField DataField="CategoryName" HeaderText="CategoryName" />
                    <asp:BoundField DataField="TypeQuestion" HeaderText="Type" />
                    <asp:BoundField DataField="Mark" HeaderText="Mark" />
                    <asp:TemplateField HeaderText="Action">
                        <ItemTemplate>
                            <asp:LinkButton ID="edit" OnClientClick='<%# "EditQuestion(" + Eval("ID") + ")" %>'
                                runat="server" Enabled="False"><img src="../Images/icon/icon_edit.png" /></asp:LinkButton>
                            <asp:LinkButton ID="del" OnClientClick='<%# "DeleteQuestion(" + Eval("ID") + ")" %>'
                                runat="server" CausesValidation="False" EnableViewState="False" Enabled="False"
                                ClientIDMode="AutoID">
                               <img src="../Images/icon/icon_delete.png" /></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <EditRowStyle BackColor="#2461BF" />
                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#ffffff" BorderStyle="None" ForeColor="#999" HorizontalAlign="Right" />
                <RowStyle BackColor="#EFF3FB" HorizontalAlign="Left" />
                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                <SortedAscendingCellStyle BackColor="#F5F7FB" />
                <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                <SortedDescendingCellStyle BackColor="#E9EBEF" />
                <SortedDescendingHeaderStyle BackColor="#4870BE" />
            </asp:GridView>
        </p>
    </div>
</asp:Content>
